<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script type="text/javascript" defer="defer" language="javascript">
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }

        function vilidateRows() {

            var table = document.getElementById("contentTable1");//获取表格元素
            var allTrs = table.getElementsByTagName("tr");//获取表格的行元素
            if (allTrs.length == 0) {
                 return;
            }
            for(var i=0;i< allTrs.length;i++){
                var tr= allTrs[i];
                if(hasClass(tr,'table-selected')){
                    loadDiv('rigthCenterDiv', '${ctx}/nurse/newbornRec/getInHosInfo?vistIdOfMother='+vistIdOfMother);
                }
            }
            toastr.error("请选择病人信息！");
            //判断某个元素是否有指定的样式
            function hasClass(element, cls) {
                return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1;
            }
        }
</script>
<div class="app">
    <section class="layout">
        <section class="main-content col-lg-3">
            <div class="content-wrap" id="leftCenterDiv">
                <div class="content-wrap">
                    <div class="wrapper" style="bottom: 50px;">
                        <ul class="nav nav-tabs">
                            <li><a href="#" onclick="loadDiv('mainCenterDiv','${ctx}/nurse/index')">床位列表</a></li>
                            <li class="active">
                                <a href="#"   onclick="loadDiv('mainCenterDiv','${ctx}/nurse/newbornRec/index')">新生儿住院登记</a>
                            </li>
                        </ul>
                        <form:form id="newBornReg" modelAttribute="newbornRec" onsubmit="return loadDivForm('mainCenterDiv','searchForm','${ctx}/nurse/newbornRec/index');" method="post" class="form-inline">
                            <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                            <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                        </form:form>
                        <section class="panel panel-default">
                            <div class="panel-body">
                                <div class="table-responsive no-border">
                                    <%-- <div class="datatable-top">
                                         <div class="pull-left">
                                             <form:form id="searchForm" modelAttribute="costItemDict"  onsubmit="return loadDivForm('mainCenterDiv','searchForm','${ctx}/htca/costItemDict/index');" method="post" class="form-inline">


                                             </form:form>
                                         </div>
                                     </div>--%>
                                    <table   id="contentTable1"  class="table table-bordered mg-t datatable">
                                        <thead>
                                        <tr>
                                            <th>床号</th>
                                            <th>床标号</th>
                                            <th>住院号</th>
                                            <th>姓名</th>
                                            <th>入院日期</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <c:forEach items="${page.list}" var="patientInfo">
                                            <tr onclick="loadDiv('rigthCenterDiv','${ctx}/nurse/newbornRec/newBornHosList?vistIdOfMother=${patientInfo.id}&patientIdOfMother=${patientInfo.patient_id}&motherInpNo=${patientInfo.visit_no}&bedNo=${patientInfo.bed_no}')">
                                                <input type="hidden" id="patientInfoId"  value="${patientInfo.id}">
                                                <td>${patientInfo.bed_no}</td>
                                                <td>${patientInfo.bed_label}</td>
                                                <td>${patientInfo.visit_no}</td>
                                                <td>${patientInfo.name}</td>
                                                <td><fmt:formatDate value="${patientInfo.admission_date}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
                                            </tr>
                                        </c:forEach>
                                        </tbody>
                                    </table>

                                    <div class="pagination">${page}</div>
                                </div>
                            </div>
                        </section>
                    </div>
                </div>
            </div>
        </section>

        <section class="main-content col-lg-8">
            <div class="content-wrap" id="rigthCenterDiv">
                <div class="wrapper" style="bottom: 50px;">
                    <ul class="nav nav-tabs">
                        <li class="active" >
                            <a href="#" onclick= "loadDiv('rigthCenterDiv','${ctx}/nurse/newbornRec/dialogHos')" >新生儿住院列表</a>
                        </li>
                        <li>
                            <a href="#" onclick="vilidateRows()">新生儿住院添加</a>
                        </li>
                    </ul>
                </div>
            </div>
        </section>
    </section>

</div>